﻿using PoemGame.Domain.GameAggregate;
using PoemGame.Domain.PlayerAggregate;
using PoemGame.Domain.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PoemGame.ApplicationService
{
    public class GamePlayServiceFactory : IGamePlayServiceFactory
    {
        protected readonly IGameRepository gameRepository;
        protected readonly IPlayerRepository playerRepository;
        protected readonly IDomainServiceFactory<ICheckAnswerService> checkAnswerServiceFactory;

        public GamePlayServiceFactory(IGameRepository gameRepository,
            IPlayerRepository playerRepository,
            IDomainServiceFactory<ICheckAnswerService> checkservicefactory)
        {
            this.gameRepository = gameRepository;
            this.playerRepository = playerRepository;
            this.checkAnswerServiceFactory = checkservicefactory;
        }

        public IGamePlayService GetGamePlayService(PlayType playType)
        {
            switch (playType)
            {
                case PlayType.FCFA:
                    return new GamePlayFCFAService(gameRepository, playerRepository, checkAnswerServiceFactory);
                case PlayType.Inturn:
                default:
                    return new GamePlayInturnService(gameRepository, playerRepository, checkAnswerServiceFactory);
            }
                

        }
    }
}
